If

Syntax:

@If variable [Not] {=/>/</<=/>=} variable

(true statement commands)

@Else (optional)

(false statements commands)

@Endif

Conditional processing is enabled using the IF command, in conjunction with Else and Endif. IF commands can be nested up to 250 levels deep. The comparators can be any one of:

= equal to, <> not equal to, > greater than, < less than,

<= less than or equal to, >= greater than or equal to.

Not can optionally be placed before the comparator.

The variable types must be compatible for the comparison to function properly. The variables to be compared must BOTH be in ONE of these three groups.

·List Attribute, string literal, string variable or string array.

·Numeric attribute, numeric literal, numeric variable or numeric array.

·Date attribute or date literal.

Several comparisons can be logically grouped using combinations of OR and AND, by enclosing each comparison within brackets ( ).

Examples

@If Grade = 'Director'
  @Assign Salary = Salary * 1.20
@Endif

Example:

@If Grade = 'Director'
  @Assign Salary = Salary * 1.20
@Else
  @Assign Salary = Salary * 1.10
@Endif

Example:

@If (Grade = 'Director') or (Grade = 'SenMgr')
  @Assign Salary = Salary * 1.20
@Endif

Example:

@If (Grade = 'Director') or ((Grade = 'SenMgr') and (Salary < 20000))
  @Assign Salary = Salary * 1.20
@Endif

In this last example Salary will be increased by 20% for Directors, and also for Senior Managers who earn less than 20,000.

Several lines can be used for the IF statement itself. The point where you split the line is quite flexible. Indentation can also be used, for example:

@If (Grade = 'Director') 
or ((Grade = 'SenMgr') and (Salary < 20000)) 
or (Dept = 'Sales')
or (Date = '24/12/90')
  @Assign Salary = Salary * 1.20
  @Assign Updated = 'Yes'
@Endif

Special Boolean Expressions